home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / TABCNTRL.PAK / GLOBALS.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  6KB  |  144 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12.  
  13. //-------------------------------------------------------------------------
  14. // Functions for handling main window messages.  The message-dispatching
  15. // mechanism expects all message-handling functions to have the following
  16. // prototype:
  17. //
  18. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  19.  
  20. // **TODO**  Add message-handling function prototypes here.  Be sure to
  21. //           add the function names to the main window message table in
  22. //           maintbls.c.
  23.  
  24. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  25. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  26.  
  27. LRESULT ChildMsgPaint(HWND, UINT, WPARAM, LPARAM);
  28.  
  29. //-------------------------------------------------------------------------
  30. // Functions for handling main window commands--ie. functions for
  31. // processing WM_COMMAND messages based on the wParam value.
  32. // The message-dispatching mechanism expects all command-handling
  33. // functions to have the following prototype:
  34. //
  35. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  36.  
  37. // **TODO**  Add message-handling function prototypes here.  Be sure to
  38. //           add the function names to the main window command table in
  39. //           maintbls.c.
  40.  
  41. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  42. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  43. LRESULT CmdDemo(HWND, WORD, WORD, HWND);
  44.  
  45.  
  46. //-------------------------------------------------------------------------
  47. // Global function prototypes.
  48.  
  49. // **TODO**  Add global function prototypes here.
  50.  
  51. BOOL InitApplication(HINSTANCE, int);
  52. BOOL CenterWindow(HWND, HWND);
  53.  
  54. // Callback functions.  These are called by Windows.
  55.  
  56. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  57. LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
  58.  
  59.  
  60. //-------------------------------------------------------------------------
  61. // Global variable declarations.
  62.  
  63. extern HINSTANCE hInst;          // The current instance handle
  64. extern char      szAppName[];    // The name of this application
  65. extern char      szTitle[];      // The title bar text
  66. extern char      szChildName[];      // The title bar text
  67.  
  68. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  69. //           line 2.  For MDI applications, uncomment line 2 below, comment
  70. //           line 1, and then define hwndMDIClient as a global variable in
  71. //           INIT.C
  72. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  73. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  74.  
  75.  
  76. //-------------------------------------------------------------------------
  77. // Message and command dispatch infrastructure.  The following type
  78. // definitions and functions are used by the message and command dispatching
  79. // mechanism and do not need to be changed.
  80.  
  81.     // Function pointer prototype for message handling functions.
  82. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  83.  
  84.     // Function pointer prototype for command handling functions.
  85. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  86.  
  87.     // Enumerated type used to determine which default window procedure
  88.     // should be called by the message- and command-dispatching mechanism
  89.     // if a message or command is not handled explicitly.
  90. typedef enum
  91. {
  92.    edwpNone,            // Do not call any default procedure.
  93.    edwpWindow,          // Call DefWindowProc.
  94.    edwpDialog,          // Call DefDlgProc (This should be used only for
  95.                         // custom dialogs - standard dialog use edwpNone).
  96.    edwpMDIChild,        // Call DefMDIChildProc.
  97.    edwpMDIFrame         // Call DefFrameProc.
  98. } EDWP;                // Enumeration for Default Window Procedures
  99.  
  100.     // This structure maps messages to message handling functions.
  101. typedef struct _MSD
  102. {
  103.     UINT   uMessage;
  104.     PFNMSG pfnmsg;
  105. } MSD;                 // MeSsage Dispatch structure
  106.  
  107.     // This structure contains all of the information that a window
  108.     // procedure passes to DispMessage in order to define the message
  109.     // dispatching behavior for the window.
  110. typedef struct _MSDI
  111. {
  112.     int  cmsd;          // Number of message dispatch structs in rgmsd
  113.     MSD *rgmsd;         // Table of message dispatch structures
  114.     EDWP edwp;          // Type of default window handler needed.
  115. } MSDI, FAR *LPMSDI;   // MeSsage Dipatch Information
  116.  
  117.     // This structure maps command IDs to command handling functions.
  118. typedef struct _CMD
  119. {
  120.     WORD   wCommand;
  121.     PFNCMD pfncmd;
  122. } CMD;                 // CoMmand Dispatch structure
  123.  
  124.     // This structure contains all of the information that a command
  125.     // message procedure passes to DispCommand in order to define the
  126.     // command dispatching behavior for the window.
  127. typedef struct _CMDI
  128. {
  129.     int  ccmd;          // Number of command dispatch structs in rgcmd
  130.     CMD *rgcmd;         // Table of command dispatch structures
  131.     EDWP edwp;          // Type of default window handler needed.
  132. } CMDI, FAR *LPCMDI;   // CoMmand Dispatch Information
  133.  
  134.     // Message and command dispatching functions.  They look up messages
  135.     // and commands in the dispatch tables and call the appropriate handler
  136.     // function.
  137. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  138. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  139.  
  140.     // Message dispatch information for the main window
  141. extern MSDI msdiMain;
  142.     // Command dispatch information for the main window
  143. extern CMDI cmdiMain;
  144.